package me.evis.mobile.sms2cal.model;

import me.evis.mobile.sms2cal.parser.Util;

/**
 * BEGIN:VALARM 
 * TRIGGER:-PT30M 
 * REPEAT:2 
 * DURATION:PT15M 
 * ACTION:DISPLAY
 * DESCRIPTION:Breakfast meeting with executive\n team at 8:30 AM EST.
 * END:VALARM
 */
public class CalAlarm {
    /**
     * Example: A trigger set 15 minutes prior to the start of the event or to-do. 
     *   TRIGGER:-P15M 
     * A trigger set 5 minutes after the end of the event or to-do. 
     *   TRIGGER;RELATED=END:P5M
     * A trigger set to an absolute date/time.
     *   TRIGGER;VALUE=DATE-TIME:19980101T050000Z
     */
    public int triggerWeeks;
    public int triggerDays;
    public int triggerHours;
    public int triggerMinutes;
    public int triggerSeconds;
    public int repeat = 1;
    public String description;
    
    /**
     * TODO hardcode: only includes triggerMinutes.
     * 
     * @return A VALARM string representation.
     */
    public String toVALARM() {
        StringBuffer sb = new StringBuffer();
        sb.append("BEGIN:VALARM").append(Util.NL);
        sb.append("TRIGGER:-P").append(triggerMinutes).append(Util.NL);
        sb.append("REPEAT:").append(repeat).append(Util.NL);
        sb.append("DESCRIPTION:").append(description).append(Util.NL);
        sb.append("END:VALARM").append(Util.NL);
        return sb.toString();
    }
}
